import Vue from 'vue'
import Router from 'vue-router'
import DefaultLayout from './layouts/Default.vue'

Vue.use(Router)

const routes = [
  {
    path: '/',
    component: DefaultLayout,
    redirect: '/index',
    children: [
      {
        path: 'index',
        name: 'home',
        component: () => import('./views/Home.vue')
      },
      {
        path: 'echarts',
        name: 'echarts',
        component: () => import('./views/EChartDemo.vue')
      },
      {
        path: 'cytoscape',
        name: 'cytoscape',
        component: () => import('./views/Cytoscape.vue')
      },
      {
        path: 'about',
        name: 'about',
        component: () => import('./views/About.vue')
      },
      {
        path: 'test',
        name: 'test',
        component: () => import('./views/test.vue')
      }
    ]
  }
]

if (process.env.MODE !== 'ssr') {
  routes.push({
    path: '*',
    component: () => import('./views/Error404.vue')
  })
}

const router = new Router({
  routes
})

export default router